<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <link href="/css/css.css" rel="stylesheet" type="text/css"/>
    <link href="/css/common.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="/js/slide.js"></script>
    <script src="/js/jquery.foucs.js" type="text/javascript"></script>
    <script src="/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="/js/jquery.SuperSlide.2.1.1.js" type="text/javascript"></script>
    <script src="/js/layer/layer.js"></script>
    <script src="/js/axios.min.js"></script>
    <script src="/js/vue.js"></script>
    <title>修改密码</title>
</head>

<body>

<!--修改密码样式-->
<div class="user_style clearfix" id="user">
    <div class="clearfix user">

        <!--右侧样式-->
        <div class="r_user_style user_right">
            <div class="user_Borders">
                <div class="title_name">
                    <span class="name">修改密码</span>
                </div>
                <!--修改密码样式-->
                <div class="about_user_info">
                    <form id="form1" name="form1" method="post" action="">
                        <div class="user_layout">
                            <ul>
                                <li><label class="user_title_name">原密码：</label><input name="oldpwd" type="password"
                                                                                      class="add_text"
                                                                                      v-model="oldpwd"/><i>*</i></li>
                                <li><label class="user_title_name">新密码：</label><input name="newpwd" type="password"
                                                                                      class="add_text"
                                                                                      v-model="newpwd"/><i>*</i></li>
                                <li><label class="user_title_name">确认新密码：</label><input name="cfmpwd" type="password"
                                                                                        class="add_text"
                                                                                        v-model="cfmpwd"/><i>*</i></li>
                            </ul>
                            <div class="operating_btn"><input name="name" type="button" value="确认" class="submit—btn"
                                                              @click="update"/>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>
<script>

    new Vue({
        el: "#user",
        data: {
            oldpwd: "",
            newpwd: "",
            cfmpwd: "",
        },
        methods: {
            update: function () {
                axios.post("update", {
                    oldpwd: this.oldpwd,
                    newpwd: this.newpwd,
                    cfmpwd: this.cfmpwd,
                }).then(r => {
                    if (r.data.code == 200) {
                        layer.msg('修改密码成功', {
                            icon: 1,
                            time: 1000 //2秒关闭（如果不配置，默认是3秒）
                        }, () => {
                            this.clear();
                        });
                    } else if (r.data.code == 201) {
                        layer.msg('原密码错误', {
                            icon: 7,
                            time: 1000 //2秒关闭（如果不配置，默认是3秒）
                        }, () => {
                            this.clear();
                        });

                    } else if (r.data.code == 202) {
                        layer.msg('确认密码与修改后密码不一致', {
                            icon: 7,
                            time: 1000 //2秒关闭（如果不配置，默认是3秒）
                        }, () => {
                            this.clear();
                        });

                    } else if (r.data.code == 203) {
                        layer.msg('密码长度要在6-16位', {
                            icon: 7,
                            time: 1000 //2秒关闭（如果不配置，默认是3秒）
                        }, () => {
                            this.clear();
                        });

                    } else if (r.data.code == 204) {
                        layer.msg('请输入数据', {
                            icon: 7,
                            time: 1000 //2秒关闭（如果不配置，默认是3秒）
                        }, () => {
                            this.clear();
                        });

                    }
                })
            },
            clear: function () {
                this.oldpwd = "";
                this.newpwd = "";
                this.cfmpwd = "";
            }
        }
    })
</script>
</body>
</html>
